<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>家人安全叮嘱 - 双柳煤矿</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
</head>
<body class="bg-gray-100">
    <div class="container mx-auto p-6">
        <div class="bg-white rounded-lg shadow-lg p-8 max-w-2xl mx-auto">
            <h2 class="text-2xl font-bold text-center mb-6 text-red-800">
                <i class="fas fa-heart mr-2"></i>给家人的安全叮嘱
            </h2>
            
            <div class="text-center mb-6">
                <p class="text-gray-600">亲爱的家人，请录制您的安全叮嘱语音或上传照片</p>
                <p class="text-sm text-gray-500 mt-2">录音最长30秒，完成后将立即生成专属二维码</p>
            </div>

            <!-- 录音区域 -->
            <div class="mb-6">
                <div class="flex justify-center space-x-4 mb-4">
                    <button id="startRecording" class="bg-green-600 text-white px-6 py-3 rounded-lg">
                        <i class="fas fa-microphone mr-2"></i>开始录音
                    </button>
                    <button id="stopRecording" class="bg-red-600 text-white px-6 py-3 rounded-lg hidden">
                        <i class="fas fa-stop mr-2"></i>停止录音
                    </button>
                </div>
                <div id="recordingStatus" class="text-center text-sm text-gray-600"></div>
            </div>

            <!-- 照片上传 -->
            <div class="mb-6">
                <label class="block text-sm font-medium text-gray-700 mb-2">上传照片（可选）</label>
                <input type="file" id="photoInput" accept="image/*" class="w-full border rounded px-3 py-2">
            </div>

            <!-- 预览区域 -->
            <div id="previewArea" class="hidden mb-6">
                <h3 class="text-lg font-semibold mb-2">预览</h3>
                <div id="audioPreview" class="hidden mb-4">
                    <audio controls class="w-full">
                        <source id="audioSource" type="audio/wav">
                    </audio>
                </div>
                <div id="photoPreview" class="hidden">
                    <img id="previewImage" class="max-w-full h-auto rounded border">
                </div>
            </div>

            <!-- 提交按钮 -->
            <button id="submitBtn" class="w-full bg-red-600 text-white py-3 rounded-lg text-lg font-semibold hidden">
                <i class="fas fa-paper-plane mr-2"></i>生成安全叮嘱二维码
            </button>

            <!-- 二维码显示区域 -->
            <div id="qrDisplayArea" class="hidden mt-6">
                <h3 class="text-lg font-semibold text-center mb-4">您的专属二维码</h3>
                <div class="text-center">
                    <img id="qrCode" class="w-48 h-48 mx-auto border">
                    <p class="text-sm text-gray-600 mt-2">保存此二维码，员工扫码即可查看您的安全叮嘱</p>
                </div>
            </div>
        </div>
    </div>

    <script src="js/family.js"></script>
</body>
</html>
